<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    #test h1{
      background-color: red;
    }
  </style>
</head>
<body>
<div id="test">
  <h1>123</h1>
  <h1>456</h1>
  <div>
    <h1>789</h1>
  </div>
</div>
</body>
</html>